package com.haixiaoke.saas.repository.service.impl;

import java.util.Date;
import java.util.List;

import com.haixiaoke.saas.repository.pojo.HouseRecommendation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.haixiaoke.saas.repository.mapper.HouseRecommendationMapper;
import com.haixiaoke.saas.repository.service.IHouseRecommendationService;

/**
 * 公寓推荐设置Service业务层处理
 *
 * @author haixiaoke
 * @date 2023-04-11
 */
@Service
public class HouseRecommendationServiceImpl implements IHouseRecommendationService {
    @Autowired
    private HouseRecommendationMapper houseRecommendationMapper;

    /**
     * 查询公寓推荐设置
     *
     * @param recommendationId 公寓推荐设置主键
     * @return 公寓推荐设置
     */
    @Override
    public HouseRecommendation selectHouseRecommendationByRecommendationId(Long recommendationId) {
        return houseRecommendationMapper.selectHouseRecommendationByRecommendationId(recommendationId);
    }

    /**
     * 查询公寓推荐设置列表
     *
     * @param houseRecommendation 公寓推荐设置
     * @return 公寓推荐设置
     */
    @Override
    public List<HouseRecommendation> selectHouseRecommendationList(HouseRecommendation houseRecommendation) {
        return houseRecommendationMapper.selectHouseRecommendationList(houseRecommendation);
    }

    /**
     * 新增公寓推荐设置
     *
     * @param houseRecommendation 公寓推荐设置
     * @return 结果
     */
    @Override
    public int insertHouseRecommendation(HouseRecommendation houseRecommendation) {
        houseRecommendation.setCreateTime(new Date());
        return houseRecommendationMapper.insertHouseRecommendation(houseRecommendation);
    }

    /**
     * 修改公寓推荐设置
     *
     * @param houseRecommendation 公寓推荐设置
     * @return 结果
     */
    @Override
    public int updateHouseRecommendation(HouseRecommendation houseRecommendation) {
        houseRecommendation.setUpdateTime(new Date());
        return houseRecommendationMapper.updateHouseRecommendation(houseRecommendation);
    }

    /**
     * 批量删除公寓推荐设置
     *
     * @param recommendationIds 需要删除的公寓推荐设置主键
     * @return 结果
     */
    @Override
    public int deleteHouseRecommendationByRecommendationIds(Long[] recommendationIds) {
        return houseRecommendationMapper.deleteHouseRecommendationByRecommendationIds(recommendationIds);
    }

    /**
     * 删除公寓推荐设置信息
     *
     * @param recommendationId 公寓推荐设置主键
     * @return 结果
     */
    @Override
    public int deleteHouseRecommendationByRecommendationId(Long recommendationId) {
        return houseRecommendationMapper.deleteHouseRecommendationByRecommendationId(recommendationId);
    }

    @Override
    public int updateState(HouseRecommendation houseRecommendation) {
        houseRecommendation.setUpdateTime(new Date());
        return houseRecommendationMapper.updateState(houseRecommendation);
    }
}
